<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr1 = ['a','b'];
        var res1 = arr1.push('c','d');
        console.log(arr1);  // ['a','b','c','d']
        console.log(res1); // 4

        var arr2 = ['a','b'];
        var res2 = arr2.pop();//删除最后面元素
        console.log(arr2); // ['a']
        console.log(res2); // b 被删除的元素

        var arr3 = ['a','b'];
        var res3 = arr3.shift();
        console.log(arr3); // ['b']
        console.log(res3); // a

        var arr4 = ['a','b'];
        var res4 = arr4.unshift('c','d');
        console.log(arr4); // ['c','d','a','b']
        console.log(res4); // 4
    </script>
</body>
</html>